'''
@author Aurelien Deharbe

This file is part of Cute-Client.

Cute-Client is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Cute-Client is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with Cute-Client.  If not, see <http://www.gnu.org/licenses/>.
'''

import time
import random
from cuteclient.csclient import CSClient

c = CSClient('localhost', 5000)
s = c.newSession("example05")

data = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

window = s.qs("QMainWindow()")
button = s.qs("QPushButton('send data', " + window + ") -> sendbtn")
s.qs(window + ".show()")

random.seed()
while True:
    s.putData("<data>", data)
    print str(data)
    time.sleep(3)
    random.shuffle(data)

s.mainloop()
